﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.Content;

namespace GBU.Services.Common
{
    public delegate void OnReceiveBroadcastDelegate(BroadcastReceiveEventArgs args);

    public class CommonBroadcastReceiver: BroadcastReceiver
    {
        public event OnReceiveBroadcastDelegate OnReceiveBroadcast;

        public override void OnReceive(Context context, Intent intent)
        {
            var result = intent.Extras.GetInt(intent.Action);
            
            if (OnReceiveBroadcast != null)
            {
                OnReceiveBroadcast(new BroadcastReceiveEventArgs() { ReceiveMessageType = intent.Action, Step = result });
            }
        }
    }
}
